from benchmark import round_and_map
import time
import cProfile

from util.load_puzzles import load_puzzles_from_file
from run_solver import _solve

def benchmark_solver():
    puzzles = list(load_puzzles_from_file("./puzzles.txt"))
    
    board_work = puzzles[1].board
    board_comp = puzzles[0].board
    comps = puzzles[0].comps
    print(f"Running benchmark on board {board_work.name} with comps form board {board_comp.name}")
    
    month = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
    day = ["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"]
    weekday = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
    
    cnt = 0
    for m in month:
        for d in day:
            for w in weekday:
                if m in ["Feb", "Apr", "Jun", "Sep", "Nov"] and d == "31":
                    continue
                sol, it = _solve(board_work, comps, d, w, m) # type: ignore
                
                if sol is None:
                    print("Failed", d, w, m)
                
                cnt += 1
                if cnt > 50: return

if __name__ == "__main__":
    cProfile.run("benchmark_solver()")